GoodReadsMetadata

data class GoodReadsMetadata(    val title: String,     val authors: List<String>,     val url: String,     val id: String,     val isbn: String?,     val pages: Int?,     val pubDate: LocalDate?) : CompilableToString, Serializable

Get book metadata from a GoodReads details page, a GoodReads ID or title/author.

Samples

import ch.derlin.grmetafetcher.GoodReadsLookup
import ch.derlin.grmetafetcher.GoodReadsMetadata
import ch.derlin.grmetafetcher.GoodReadsPaginatedSearchResults
import ch.derlin.grmetafetcher.Retry
import ch.derlin.grmetafetcher.RetryConfiguration
fun main() { 
   //sampleStart 
   val p: (GoodReadsMetadata) -> Unit = { println(it.toCompilableString()) }

// very shot titles need authors to match
p(GoodReadsMetadata.lookup(title = "substance", author = "claro"))
// Authors will match without the initials, and can be ignored in search for specific/long enough titles
p(GoodReadsMetadata.lookup("House of Leaves", "Mark Danielewski", includeAuthorInSearch = false))
// Subtitle can be ignored in lookup
p(GoodReadsMetadata.lookup(title = "Masters of Doom"))

// The same can be achieved using GoodReadsLookup // accents don't matter
p(GoodReadsLookup(title = "la cle de salomon").findBestMatch().getMetadata())

// If you know the URL or GoodReads ID, you can use them directly
p(GoodReadsMetadata.fromGoodReadsId("41940388")) 
   //sampleEnd
}

Constructors

Link copied to clipboard
fun GoodReadsMetadata(    title: String,     authors: List<String>,     url: String,     id: String,     isbn: String?,     pages: Int?,     pubDate: LocalDate?)

Types

Link copied to clipboard
object Companion

Functions

Link copied to clipboard
open override fun toCompilableString(): String

Should return the String representation of this class as a compilable snippet (can be copy-pasted into Kotlin code).

Properties

Link copied to clipboard
val authors: List<String>

The list of main authors (excluding editor, illustrators, etc), as found on GoodReads.

Link copied to clipboard
val authorsStr: String

The list of authors, comma-separated.

Link copied to clipboard
val id: String

The GoodReads ID for this book.

Link copied to clipboard
val isbn: String?

The ISBN of the edition shown in the details page of GoodReads, if present. If both ISBN10 and ISBN13 are present on the page, the latter is used.

Link copied to clipboard
val pages: Int?

The number of pages, if present.

Link copied to clipboard
val pubDate: LocalDate?

The earliest publication date (first published), if present.

Link copied to clipboard
val title: String

The complete title, as found on GoodReads.

Link copied to clipboard
val url: String

The URL of the book on GoodReads. Note that it can also be reconstructed from the id, using GoodReadsUrl.forBookId.

Sources

Link copied to clipboard